/**
 * Copyright (C) 2010 Cloudfarming <info@cloudfarming.nl>
 *
 * Licensed under the Eclipse Public License - v 1.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         http://www.eclipse.org/legal/epl-v10.html
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package nl.cloudfarming.client.messaging;

import nl.cloudfarming.eventbus.GuiEvent;
import nl.cloudfarming.eventbus.GuiEventKey;

/**
 * Event which is used to let other components know there is a new message 
 * 
 * @author Gerben Feenstra
 */
public class MessageEvent implements GuiEvent<Message>{

        private final Message message;
        private final MessageEventKey key;

        /**
         * Constructor, create a Message-event.
         * @param message The message for which the event is triggered
         * @param key The event key. Which action has been done to trigger this event. 
         */
        public MessageEvent(Message message, MessageEventKey key) {
            this.message = message;
            this.key = key;
        }

        @Override
        public GuiEventKey getKey() {
            return key;
        }

        @Override
        public Message getContent() {
            return message;
        }
    }
